export default {
  namespaced: true,
  state: {
    id: 0,
    name: '',
    dictMaps: [],
    dictObject: {}
  },
  mutations: {
    updateId (state, id) {
      state.id = id
    },
    updateName (state, name) {
      state.name = name
    },
    getDictList (state, data = {}) {
      let obj = {}
      for (const key in data) {
        if (!obj[key]) {
          obj[key] = {}
        }
        data[key].map(m => {
          obj[key][m.value] = m.label
        })
      }
      state.dictObject = obj
      state.dictMaps = data
    }
  }
}
